package com.czk.controller;

import com.alibaba.fastjson.JSON;
import com.czk.dao.HelloDao;
import com.czk.pojo.User;
import com.czk.utils.PageHelperUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/4/18 13:54
 */
@RestController
public class HelloController {
    @Autowired
    private HelloDao helloDao;

    @RequestMapping("/test")
    public String test() {
        User user = helloDao.selectById(1);
        Map<String, Object> map = new HashMap<>(16);
        map.put("id", 2);
        map.put("name", "howard");
        map.put("password", "howard");
        helloDao.updateById(map);
        PageHelperUtils.setPage(1, 3);
        List<User> users = helloDao.selectAll();
        System.out.println(users);
        return JSON.toJSONString(user);
    }
}
